<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta -equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
	<style>
		#editor1 {
            display: inline-block;
            width: 80%;
        }
	</style>
</head>
<body>
<div id="dm">
    <marquee behavior="scroll" direction="left" scrollamount="30"><font color="red" size="15px" >666</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="20"><font color="aqua" size="20px">又五杀了</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="25"><font >666</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="20"><font color="pink" size="10px">666</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="28"><font color="red">666</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="20"><font color="greenyellow" size="20px">牛蛙牛蛙</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="10"><font size="16px" >666</font> </marquee>
    <marquee behavior="scroll" direction="left" scrollamount="15"><font color="pink" size="20px">厉害</font> </marquee>
</div>
<div>
    <textarea id="editor1" class='form-control' >
       
    </textarea>
	<button id="btn1" type="button" class="button red"><b>发送</b></button></div>
</body>
<script>
    
    // 默认文本聚焦的
    var editor1 = document.getElementById("editor1");
    editor1.focus();
    var i = 0;
    var text = ""
    
    var text1 = "#include&lt;stdio.h&gt; int main() { printf(\"Hello World 2023\"); return 0;}";

    var t = ""
    var timer = null;

    var dm =  document.getElementById("dm");
    var btn1 =  document.getElementById("btn1");

    // 输出字的函数
    function type()
    {
        editor1.focus();
        t += text[i];
        // console.log(t)
        i ++;
        editor1.innerHTML = "<h1>" + t + "</h1>";
        if (i >= text.length){
            
            clearInterval(timer)
            i = 0;
            text="";
            
        }
        
    }
    btn1.onclick = function(){
        dm.innerHTML += ('<marquee behavior="scroll" direction="left" scrollamount="30"><font color="red" size="15px" >' + editor1.value + '</font> </marquee>')
    
        editor1.value = ""
        
        editor1.focus();
    }

    document.onkeydown = function (event) {
        var e = event || window.event;
        if (e && e.keyCode == 13) { //回车键的键值为13
            btn1.click(); //调用登录按钮的登录事件
        }
    };
</script>
</html>